<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        /* 
        // 1
        console.log(true + 3);  // 4
        console.log('3' - 2);    // 1
        console.log(5 + '12');   // 512
        console.log(undefined + 11); // NaN */


        /*  
        // 2
        var name = 'window对象';
         var obj = {
             name: 'obj对象',
             say: function () {
                 console.log(this.name);//obj对象
             },
             props: {
                 name: 'props对象',
                 run: function () {
                     var that = this;
                     console.log(name); // window对象
                 },
                 sing: function () {
                     var that = this;
                     function aa() {
                         console.log(this.name);// window 对象
                     }
                     return aa;
                 }
             }
         }
         console.log(obj.say());    // undefined
         obj.props.run();
         var nn = obj.props.sing();
         nn(); */



        /*    // 3. 
           function show() {
               console.log(name);
               name = 'show对象';
               function name() {
                   console.log(this.name);
               }
               console.log(name);
           }
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  
           var name = 'window对象';
           show();     //window对象
            */

        // 4.
        /* function Show(age) {
           this.name = 'show对象';
           var age = 18;
           this.run = function () {
               console.log(this.age);// undefined
           }
       }
       var ss = new Show(23);
       console.log(ss.run()); // undefined
       console.log(ss); // Show{name:'show对象'，run：f}
*/
        // 5.
        /* var x = 1, y = 0, z = 0;
        function add(n) {
            n = n + 1;
        }
        y = add(x);
        function adds(m) {
            m = m + 1;
        }
        z = add(y);
        console.log(y + z); // NaN
        console.log(z); // undefined */

        /*    // 6.
           var m = 2, n = 1, k;
           for (var i = 1; i < 10; i++) {
               m++;
               n++;
           }
           var k = m + n + i;
           console.log(k);//31 */


        /*       //7.
              var m = 2, n = 1, k;
              for (var i = 1; i < 10; i++) {
                  m++;
                  n++;
              }
              var k = m + n + i;
              console.log(k); // 31 */
        /* 
                //8.
                var obj1 = { name: 'yan', age: 15 };
                var obj2 = { name: 'yan', age: 15 };
                console.log(obj1 == obj2); // false
                obj2.age = 19;
                console.log(obj1); // {name:'yan',age:15} */

        /*   //9.
          for (var i = 0; i < 5; i++) {
              setTimeout(function () {
                  console.log(new Date().getMonth(), i); // 5遍  8，5
              }, 1000);
          }
   */

        //10.
        /*   var k = 1;
          for (var i = 0, j = 1; i < 3, j < 5; i++, j++) {
              setTimeout(function () {
                  k += i + j;
                  console.log(k);// 14  23  32  41
              })
              k++;
          } */
        console.log(undefined + 11); //NaN
    </script>
</body>

</html>